<template>
  <div class="app-container home">
    <img style="width: 100%" src="@/assets/401_images/home_bg.jpg" alt="" />
  </div>
</template>

<script>
import { shopShu } from "@/api/login";

export default {
  name: "Index",
  data() {
    return {
      echData: [],
      // 版本号
      version: "3.8.7",
    };
  },

  created() {},

  mounted() {
    this.getech();

    this.getdataShu();
  },
  methods: {
    async getdataShu() {
      const { data } = await shopShu({ days: 15 });
      console.log(data);

      this.echData = data;

      let hang = this.echData.map((item) => item.dateStr);
      let rows = this.echData.map((item) => item.count);
      this.getech(hang, rows);
    },

    goTarget(href) {
      window.open(href, "_blank");
    },

    getech(hang, rows) {
      // 基于准备好的dom，初始化echarts实例
      const userdom = this.$refs.box;
      const mycart = this.$echarts.init(userdom);

      const option = {
        xAxis: {
          type: "category",
          data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data: [820, 932, 901, 934, 1290, 1330, 1320],
            type: "line",
            smooth: true,
          },
        ],
      };

      mycart.setOption(option);
    },
  },
};
</script>

<style scoped lang="scss">
.fonc {
  font-weight: 700;
  font-size: 26px;
}
.echart-box {
  width: 100%;
  height: 350px;
  margin: 20px auto;
}

.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }
  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
</style>
